package com.freesun.autoui.share;

import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * desc: operatecookies
 * Created by yangfei on 13-12-31.
 */
public class OperateCookies {

    private static Logger log = LoggerFactory.getLogger(OperateCookies.class.getClass());

    public static void deleteAllCookies(WebDriver driver){
        try {
            driver.manage().deleteAllCookies();
            log.warn("清除cookies 成功!");
        }catch (Exception e){
            log.error(e.getLocalizedMessage());
        }
    }

    public static void deleteCookiesByName(WebDriver driver,String cookieName){
        try {
            driver.manage().deleteCookieNamed(cookieName);
            log.warn("清除"+cookieName+"成功!");
        }catch (Exception e){
           log.error(e.getLocalizedMessage());
        }

    }
}
